package unitymsg.security;

import java.math.BigInteger;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.Date;

public class X509Certificate 
{
	/**
	 * Creates a self-signed X509 Certificate
	 */
	public X509Certificate(KeyPair keypair, String attributes, BigInteger sn, Date start, Date end)
	{
		
	}
	
	/**
	 * Creates a X509 Certificate issued by the owner of the given Private Key
	 */
	public X509Certificate(PublicKey subjectPubKey, PrivateKey issuerPrivKey, String subjectAttrs, String issuerAttrs, BigInteger sn, Date start, Date end)
	{
		
	}
	
	/**
	 * Checks if this certificate is currently within it's valid time period
	 */
	public boolean isValid()
	{
		return this.isValidOn(null);
	}
	
	/**
	 * Checks if this certificate is valid in the given date
	 */
	public boolean isValidOn(Date date)
	{
		return false;
	}
	
	/**
	 * Returns the X500 attributes from the issuer of the certificate
	 */
	public String getIssuerAttributes()
	{
		return null;
	}
	
	/**
	 * Returns the X500 attributes from the subject (owner) of the certificate
	 */
	public String getSubjectAttributes()
	{
		return null;
	}
	
	/**
	 * Returns the serial number of this certificate
	 */
	public BigInteger getSerialNumber()
	{
		return null;
	}
	
	/**
	 * Returns the starting date of the validity period
	 */
	public Date getStartDate()
	{
		return null;
	}
	
	/**
	 * Returns the ending date of the validity period
	 */
	public Date getEndDate()
	{
		return null;
	}
	
	/**
	 * Returns the name of the algorithm used to sign this certificate
	 */
	public String getSignatureAlgorithmName()
	{
		return null;
	}
	
	/**
	 * Returns the public key signed within this certificate
	 */
	public PublicKey getPublicKey()
	{
		return null;
	}
	
	/**
	 * Returns this certificate in encoded format
	 */
	public byte[] getEncoded()
	{
		return null;
	}
	
	/**
	 * Checks if this certificate is self-signed
	 */
	public boolean isSelfSigned()
	{
		return this.isIssuedBy(this.getPublicKey());
	}
	
	/**
	 * Checks if this certificate was issued by the owner of the given public key
	 */
	public boolean isIssuedBy(PublicKey issuerPublicKey)
	{
		return false;
	}
}
